#pragma once 

#include <vector>

using std::vector;
namespace Network
{
	namespace BinaryConversion
	{
		union byteint
		{
			unsigned char b[sizeof(int)];
			int i;
		};

		union byteFloat
		{
			unsigned char b[sizeof(float)];
			float f;
		};

		class ConvertionClass
		{
		public:
			


			static void ConvertIntToByteArray(vector<unsigned char>& p_vector, int p_toConvert)
			{
				byteint temp;
				temp.i = p_toConvert;
				
				for (int index = 0; index < 4; index++)
				{
					p_vector.push_back(temp.b[index]);
				}
			}

			static void ConvertFloatToByteArray(vector<unsigned char>& p_vector, float p_toConvert)
			{
				byteFloat temp;
				temp.f = p_toConvert;

				for (int index = 0; index < 4; index++)
				{
					p_vector.push_back(temp.b[index]);
				}
			}

			static int ConvertByteArrayToInt(vector<unsigned char>& p_vector)
			{
				byteint temp;

				for (int index = 0; index < 4; index++)
				{
					temp.b[index] = p_vector[index];
				}
				return temp.i;
			}

			static float ConvertByteArrayToFloat(vector<unsigned char>& p_vector)
			{
				byteFloat temp;
				for (int index = 0; index < 4; index++)
				{
					temp.b[index] = p_vector[index];
				}
				return temp.f;
			}




		};
	}
}//Network